package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_docker//container:image.bzl", "container_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("//prow:def.bzl", "prow_image")

filegroup(
    name = "templates",
    srcs = glob(["template/**/*"]),
)

container_image(
    name = "asset-base",
    base = "@git-base//image",
    # With paths relative to the current directory.
    data_path = ".",
    # Add files under into the root directory.
    directory = "/",
    files = [
        ":templates",
        "//prow/cmd/deck/static",
    ],
)

NAME = "deck"

prow_image(
    name = "image",
    base = ":spyglass-lenses",
    component = NAME,
    visibility = ["//visibility:public"],
)

container_image(
    name = "spyglass-lenses",
    base = ":asset-base",
    data_path = "/prow/spyglass/lenses",
    directory = "/lenses",
    files = [
        "//prow/spyglass/lenses:resources",
        "//prow/spyglass/lenses:templates",
    ],
)

go_binary(
    name = NAME,
    data = [
        ":templates",
        "//prow/cmd/deck/static",
        "//prow/spyglass/lenses:resources",
        "//prow/spyglass/lenses:templates",
    ],
    embed = [":go_default_library"],
    pure = "on",
)

go_test(
    name = "go_default_test",
    srcs = [
        "badge_test.go",
        "job_history_test.go",
        "main_test.go",
        "pr_history_test.go",
        "tide_test.go",
    ],
    embed = [":go_default_library"],
    deps = [
        "//prow/apis/prowjobs/v1:go_default_library",
        "//prow/client/clientset/versioned/fake:go_default_library",
        "//prow/config:go_default_library",
        "//prow/deck/jobs:go_default_library",
        "//prow/flagutil:go_default_library",
        "//prow/github:go_default_library",
        "//prow/github/fakegithub:go_default_library",
        "//prow/githuboauth:go_default_library",
        "//prow/io:go_default_library",
        "//prow/io/providers:go_default_library",
        "//prow/pluginhelp:go_default_library",
        "//prow/plugins:go_default_library",
        "//prow/spyglass/lenses/buildlog:go_default_library",
        "//prow/spyglass/lenses/common:go_default_library",
        "//prow/spyglass/lenses/junit:go_default_library",
        "//prow/spyglass/lenses/metadata:go_default_library",
        "//prow/tide:go_default_library",
        "//prow/tide/history:go_default_library",
        "@com_github_fsouza_fake_gcs_server//fakestorage:go_default_library",
        "@com_github_google_go_cmp//cmp:go_default_library",
        "@com_github_gorilla_sessions//:go_default_library",
        "@com_github_sirupsen_logrus//:go_default_library",
        "@io_k8s_api//core/v1:go_default_library",
        "@io_k8s_apimachinery//pkg/api/equality:go_default_library",
        "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
        "@io_k8s_apimachinery//pkg/util/diff:go_default_library",
        "@io_k8s_apimachinery//pkg/util/sets:go_default_library",
        "@io_k8s_sigs_controller_runtime//pkg/client:go_default_library",
        "@io_k8s_sigs_yaml//:go_default_library",
        "@org_golang_x_oauth2//:go_default_library",
    ],
)

go_library(
    name = "go_default_library",
    srcs = [
        "badge.go",
        "job_history.go",
        "main.go",
        "pluginhelp.go",
        "pr_history.go",
        "templates.go",
        "tide.go",
    ],
    importpath = "k8s.io/test-infra/prow/cmd/deck",
    deps = [
        "//prow/apis/prowjobs/v1:go_default_library",
        "//prow/client/clientset/versioned/typed/prowjobs/v1:go_default_library",
        "//prow/cmd/deck/version:go_default_library",
        "//prow/config:go_default_library",
        "//prow/config/secret:go_default_library",
        "//prow/deck/jobs:go_default_library",
        "//prow/flagutil:go_default_library",
        "//prow/gcsupload:go_default_library",
        "//prow/git/v2:go_default_library",
        "//prow/github:go_default_library",
        "//prow/githuboauth:go_default_library",
        "//prow/interrupts:go_default_library",
        "//prow/io:go_default_library",
        "//prow/io/providers:go_default_library",
        "//prow/kube:go_default_library",
        "//prow/logrusutil:go_default_library",
        "//prow/metrics:go_default_library",
        "//prow/pjutil:go_default_library",
        "//prow/pluginhelp:go_default_library",
        "//prow/plugins:go_default_library",
        "//prow/plugins/trigger:go_default_library",
        "//prow/pod-utils/downwardapi:go_default_library",
        "//prow/pod-utils/gcs:go_default_library",
        "//prow/prstatus:go_default_library",
        "//prow/simplifypath:go_default_library",
        "//prow/spyglass:go_default_library",
        "//prow/spyglass/api:go_default_library",
        "//prow/spyglass/lenses:go_default_library",
        "//prow/spyglass/lenses/buildlog:go_default_library",
        "//prow/spyglass/lenses/common:go_default_library",
        "//prow/spyglass/lenses/coverage:go_default_library",
        "//prow/spyglass/lenses/junit:go_default_library",
        "//prow/spyglass/lenses/metadata:go_default_library",
        "//prow/spyglass/lenses/podinfo:go_default_library",
        "//prow/spyglass/lenses/restcoverage:go_default_library",
        "//prow/tide:go_default_library",
        "//prow/tide/history:go_default_library",
        "@com_github_gorilla_csrf//:go_default_library",
        "@com_github_gorilla_sessions//:go_default_library",
        "@com_github_nytimes_gziphandler//:go_default_library",
        "@com_github_prometheus_client_golang//prometheus:go_default_library",
        "@com_github_sirupsen_logrus//:go_default_library",
        "@io_k8s_api//core/v1:go_default_library",
        "@io_k8s_apimachinery//pkg/api/errors:go_default_library",
        "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
        "@io_k8s_apimachinery//pkg/util/errors:go_default_library",
        "@io_k8s_apimachinery//pkg/util/sets:go_default_library",
        "@io_k8s_client_go//kubernetes/typed/core/v1:go_default_library",
        "@io_k8s_sigs_controller_runtime//pkg/client:go_default_library",
        "@io_k8s_sigs_controller_runtime//pkg/manager:go_default_library",
        "@io_k8s_sigs_yaml//:go_default_library",
        "@org_golang_x_oauth2//:go_default_library",
    ],
)

filegroup(
    name = "package-srcs",
    srcs = glob(["**"]),
    tags = ["automanaged"],
    visibility = ["//visibility:private"],
)

filegroup(
    name = "all-srcs",
    srcs = [
        ":package-srcs",
        "//prow/cmd/deck/static:all-srcs",
        "//prow/cmd/deck/version:all-srcs",
    ],
    tags = ["automanaged"],
)
